<%--
  Created by IntelliJ IDEA.
  User: ThinkPad
  Date: 2016/10/31
  Time: 15:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.9.2/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.js"></script>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/jquery.cookie/1.4.1/jquery.cookie.js"></script>
<script src="http://apps.bdimg.com/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<head>
    <title>test.jsp</title>
    <script>
        $(function () {

        });

        function send() {
            var body=[];
            var data1={"name":"test1","password":"gz1"};
            var data2={"name":"test2","password":"gz2"};
            body.push(data1);
            body.push(data2);

            $.ajax({
                url:"<%=request.getContextPath()%>/friend/testr",
                method:"post",
                type:"json",
                contentType:"application/json",
                data:JSON.stringify(body),
                success: function (result) {
                    console.log(result);
                },
                complete: function () {
                }
            });
        }


        function testbinding() {
//            var user = {"name":"jim"};
            var date = new Date();
            $.ajax({
                url:"<%=request.getContextPath()%>/friend/test_binding?myDate=2017-06-25",
                method:"get",
                type:"json",
//                contentType:"application/json",
//                data:{"myDate":date},
                success: function (result) {
                    console.log(result);
                },
                complete: function () {
                }
            });
        }
    </script>
</head>
<body>
    <div class="container">
        <h1>${name}</h1>
        <h1>${value}</h1>
        <h1>${user.name}</h1>
        <p>
            <a href="javascript:;" class="btn btn-default" onclick="send()">send</a>

        </p>
        <p>
            <a href="javascript:;" class="btn btn-default" onclick="testbinding()">testbinding</a>
        </p>

        <form class="form-horizontal" method="post" action="<%=request.getContextPath()%>/friend/sub">
            <input type="text" class="form-control" name="id" value="1">
            <input type="text" class="form-control" name="name" value="jim">
            <input type="datetime" class="form-control" name="createTime" >
            <input type="text" class="form-control" name="udata.id" value = 3>
            <button type="submit" class="btn btn-default">submit</button>
        </form>
    </div>
</body>
</html>